package com.zhu.transaction.mapper;

import com.zhu.transaction.pojo.Order;
import com.zhu.transaction.pojo.reports.OrderReports;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zhu
 * @since 2021-01-07
 */
public interface OrderMapper {

    //添加订单
    int addOneOrder(Order order);

    //删除订单
    int deleteOrder(String orderId);

    //更新订单状态
    int updateOrderTransactionState(@Param("orderId") String orderId, @Param("newState") Integer newState);

    //更新订单支付状态
    int updateOrderPaymentState(@Param("orderId") String orderId, @Param("newState") Integer newState);

    //通过卖方Id查询顶订单
    List<Order> queryOrderByReleaseUserId(String userId);

    //通过买方Id查询顶订单
    List<Order> queryOrderByPurchaseUserId(String userId);

    //查询所有订单
    List<Order> queryAllOrder();

    //通过订单号查询订单
    List<Order> queryOrderByOrderId(String orderId);

    //更新支付接口
    int updatePayStatus(Order order);

    //查询每日订单数
    List<OrderReports> queryNewOrderReports();

    //查询状态对应的订单数
    List<OrderReports> queryOrderStateReports();

    //查询支付方式的比例
    List<OrderReports> queryPayWayReports();

}
